import React, { forwardRef, useRef } from 'react';
import { Modal } from 'antd';
import DataTable from './DataTable';

const ModalTable: React.FC = forwardRef((prods, ref) => {
  // 表格
  let tableRef = useRef();
  return (
    <Modal
      width='70%'
      title='规则列表'
      mask={true}
      maskClosable={false}
      destroyOnClose={true}
      onCancel={() => {
        prods.onCancel();
      }}
      visible={prods.modalVisible}
      footer={false}
    >
      <DataTable
        ref={tableRef}
        mode={2}
        search={prods?.tableProds?.search ?? {}}
        columns={prods?.tableProds?.columns ?? ['id', 'name']}
        operate={prods?.tableProds?.operate ?? {}}
      />
    </Modal>
  );
});

export default ModalTable;
